package Lesson15;

public class Person 
{
	String name;
	int age;
	String personalNumber;
	String sex;
	boolean isMale;
	double weight;
	Person[] friend;
	int health = 50; //from 0 to 100
	int starvationStatus = 50; //from 0 to 100
	int mentalStatus = 50; //from 0 to 100
	double money;
	Car car;
	
	Person()
	{
		this.age = 0;
		this.weight = 4;
	}
	
	Person(String name, String personalNumber, boolean isMale)
	{
		this();
		this.name = name;
		this.personalNumber = personalNumber;
		this.isMale = isMale;
		this.friend = new Person[3];
		for(int i = 0; i<this.friend.length; i++)
		{
			friend[i] = new Person();
		}
		friend[0].name = "ivancho";
	}
	
	Person(String personName, int personAge)
	{
		name = personName;
		age = personAge;
	}
	
	
	void eat(int foodVolume)
	{
		if(starvationStatus + foodVolume >= 100)
			starvationStatus = 100;
		else
			starvationStatus += foodVolume;
	}
	
	void walk()
	{
		System.out.println(name + " is walking");
		starvationStatus -= 5;
	}
	
	void growUp()
	{
		age++;
	}
	
	void drinkWater(double litres)
	{
		System.out.println(name + " is drinking" + litres + " litres of water.");
		starvationStatus += litres;
	}
	void printPerson(Person person)
	{
		System.out.println(person.name);
		System.out.println(person.age);
		System.out.println(person.personalNumber);
		System.out.println(person.isMale);
		System.out.println(person.weight);
	}
	void buyCar(Car car)
	{
		if(this.money >= car.price)
		{
			this.car = car;
			car.changeOwner(this);
		}
	}
	double sellCarForScrap()
	{
		double returnedMoney = car.calculateCarPriceForScrap(2);
		this.money += returnedMoney;
		return returnedMoney;
	}
	
	
	
}
